package com.zxj.shop.back.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.zxj.shop.common.util.ConstatfinalUtil;
/**
 * 管理员登陆后的controller
 * @author zxj
 *
 */
@Controller
@RequestMapping("/back/admins")
public class AdminsBackController
{
    /**
     * 登陆后页面
     */
	@RequestMapping("/main")
	public String main()
	{
		ConstatfinalUtil.LOGGER.info("-----main-----");
		return "/back/main";
	}
	/*退出*/
    public String logout(HttpServletRequest request,HttpSession session)
    {
    	ConstatfinalUtil.LOGGER.info("---logout--------");
    	/*将session中的信息删除*/
    	session.removeAttribute("admins");
    	session.removeAttribute("lastLoginTime");
    	
    	/*操作Token*/
    	String token =request.getParameter("token");
    	if(token==null)
    	{
    		token=""
    				;
    	}
    	if(!"".equalsIgnoreCase(token))
    	{
    		ConstatfinalUtil.TOKEN_MAP.remove(token);	
    	}
    	/*this.info=ConstatfinalUtil.INFO_JSON.getString("4");
    	session.setAttribute("info", info);*/
    	return "redirect:/main.htm";
    }
}
